package hu.debrecen.adastra.card.config;

import hu.debrecen.adastra.card.service.SocialUserService;
import hu.debrecen.adastra.card.web.resolver.AccountArgumentResolver;
import hu.debrecen.adastra.card.web.resolver.UserSocialReferenceArgumentResolver;

import java.util.List;

import javax.inject.Inject;

import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
@EnableWebMvc
@ImportResource("classpath:/META-INF/spring/webmvc-config.xml")
public class WebMvcConfig extends WebMvcConfigurerAdapter {

	@Inject
	private SocialUserService socialUserService;

	@Override
	public void addArgumentResolvers(final List<HandlerMethodArgumentResolver> argumentResolvers) {
		super.addArgumentResolvers(argumentResolvers);
		argumentResolvers.add(new AccountArgumentResolver(this.socialUserService));
		argumentResolvers.add(new UserSocialReferenceArgumentResolver(this.socialUserService));
	}

}
